how to replace an element in an array in c